package com.ruoyi.mes.service.impl;

import java.util.List;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.mapper.LnyProInventoryMapper;
import com.ruoyi.mes.domain.LnyProInventory;
import com.ruoyi.mes.service.ILnyProInventoryService;

/**
 * 库存总览Service业务层处理
 * 
 * @author CFL
 * @date 2024-04-28
 */
@Service
public class LnyProInventoryServiceImpl implements ILnyProInventoryService 
{
    @Autowired
    private LnyProInventoryMapper lnyProInventoryMapper;

    /**
     * 查询库存总览
     * 
     * @param id 库存总览主键
     * @return 库存总览
     */
    @Override
    public LnyProInventory selectLnyProInventoryById(Long id)
    {
        return lnyProInventoryMapper.selectLnyProInventoryById(id);
    }

    /**
     * 查询库存总览列表
     * 
     * @param lnyProInventory 库存总览
     * @return 库存总览
     */
    @Override
    public List<LnyProInventory> selectLnyProInventoryList(LnyProInventory lnyProInventory)
    {

        return lnyProInventoryMapper.selectLnyProInventoryList(lnyProInventory);
    }

    /**
     * 新增库存总览
     * 
     * @param lnyProInventory 库存总览
     * @return 结果
     */
    @Override
    public int insertLnyProInventory(LnyProInventory lnyProInventory)
    {
        BaseController baseController = new BaseController();
        String username = baseController.getUsername();
        // 设置创建者和创建时间
        lnyProInventory.setCreatedBy(username);
        lnyProInventory.setCreatedTime(DateUtils.getNowDate());
        return lnyProInventoryMapper.insertLnyProInventory(lnyProInventory);
    }

    /**
     * 修改库存总览
     * 
     * @param lnyProInventory 库存总览
     * @return 结果
     */
    @Override
    public int updateLnyProInventory(LnyProInventory lnyProInventory)
    {
        return lnyProInventoryMapper.updateLnyProInventory(lnyProInventory);
    }

    /**
     * 批量删除库存总览
     * 
     * @param ids 需要删除的库存总览主键
     * @return 结果
     */
    @Override
    public int deleteLnyProInventoryByIds(Long[] ids)
    {
        return lnyProInventoryMapper.deleteLnyProInventoryByIds(ids);
    }

    /**
     * 删除库存总览信息
     * 
     * @param id 库存总览主键
     * @return 结果
     */
    @Override
    public int deleteLnyProInventoryById(Long id)
    {
        return lnyProInventoryMapper.deleteLnyProInventoryById(id);
    }
}
